﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace HCFramework.Product.Detail.Control
{
    public partial class AddToCart : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnBuyNow_Click(object sender, EventArgs e)
        {
            if (!M.Validation.IsValidInt(txtCount.Text))
            {
                M.Message.ShowError("Số lượng không hợp lệ");
                return;
            }

            C.ShoppingCart.Add(M.UrlQuery.productID.Value, int.Parse(txtCount.Text));

            Response.Redirect(@"~\Product\ShoppingCart\Default.aspx");
        }
    }
}